package com.accp.ssmoa.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.accp.ssmoa.dao.UserMapper;
import com.accp.ssmoa.pojo.User;
import com.accp.ssmoa.service.UserService;


@Service("userServiceImpl")
public class UserServiceImpl implements UserService {

	@Resource()
	private UserMapper userService;
	
	
	public List<User> getPageUser(Integer startRow, 
			Integer pageSize,Integer departmentid) {

		return userService.selectPageUsers(startRow, pageSize, departmentid);
	}

	public int getTotalsize(Integer departmentId) {
		
		return userService.selectCount(departmentId);
	}

	public User getUserById(Integer id) {
		
		return userService.selectUserDepartmentById(id);
	}

	public int save(User user) {
		
		return userService.insertSelective(user);
	}

	public int update(User user) {
		
		return userService.updateByPrimaryKeySelective(user);
	}

	public int delete(List<Integer> ids) {
		
		return userService.deleteByIds(ids);
	}

	public User getUserByName(String name) {
		
		return userService.selectByUserName(name);
	}

}
